Lock down /proc/kcore
authorDavid Howells <dhowells@redhat.com>
Wed, 8 Nov 2017 15:11:37 +0000 (15:11 +0000)
committerSalvatore Bonaccorso <carnil@debian.org>
Sun, 30 Dec 2018 09:04:03 +0000 (09:04 +0000)
Disallow access to /proc/kcore when the kernel is locked down to prevent
access to cryptographic data.

Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: James Morris <james.l.morris@oracle.com>
Gbp-Pq: Topic features/all/lockdown
Gbp-Pq: Name 0025-Lock-down-proc-kcore.patch

fs/proc/kcore.c

index d297fe4472a960b29fd62018535400c5b96a975f..0235871c7e4fde0b18e53a2b412e5204da409e03 100644 (file)
@@ -518,6 +518,8 @@ out:
 
 static int open_kcore(struct inode *inode, struct file *filp)
 {
+       if (kernel_is_locked_down("/proc/kcore"))
+               return -EPERM;
        if (!capable(CAP_SYS_RAWIO))
                return -EPERM;